<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no">
    <title>Document</title>
    <script type="text/javascript" src="js/index.js"></script>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/location.css">
</head>

<body>
    <header>
        <i class="backArrow"></i> 保拍网
    </header>
    <div class="main">
        <div class="search-box">
            <input type="text" class="search-city" placeholder="请输入城市名">
            <i class="searchIcon-gray"></i>
        </div>
        <div class="myCity">
            <div class="tit">定位城市</div>
            <div class="myCityName">上海</div>
        </div>
        <div class="hotCity">
            <div class="hotCity-tit">热门城市</div>
            <ul class="hotCity-box">
                <li onClick="check(this)" val="1" class="hotCity-list">上海</li>
                <li onClick="check(this)" val="2" class="hotCity-list">北京</li>
                <li onClick="check(this)" val="26" class="hotCity-list">福建</li>
                <li onClick="check(this)" val="27" class="hotCity-list">安徽</li>
                <li onClick="check(this)" val="23" class="hotCity-list">四川</li>
                <li onClick="check(this)" val="18" class="hotCity-list">广东</li>
            </ul>
        </div>
        <div class="allCity">
            <div class="allCity-tit">所有城市</div>
            <dl class="allCity-list"></dl>

        </div>
    </div>
</body>
<script>
    var notice = function () {
        var data = { pid: 0 };
        $.commonAjax({
            url: 'B013',
            type: 'POST',
            data: data,
            isShowError: true,
            success: function (res) {
                console.log(res.data);
                htm = '';
                $.each(res.data, function (k, v) {
                    htm += '<dd onClick="check(this)" val="' + v.code + '"  class="cityName">' + v.name + '</dd>'
                });
                $('.allCity-list').html(htm);
            }, error: function (res) {
                $.layermsg(res.msg);
            }
        });
    }
    var check = function (obj) {
        $.setSession('area_code', $(obj).attr('val'));
        $.setSession('area_name', $(obj).text());
        bp.jump('index.html');
    }
    $(function () {
        var area_name = $.getSession('area_name');
        if (area_name) {
            $('.myCityName').text(area_name);
        }
        notice();
    })

</script>

</html>